package com.ti.demo.configuration;

import org.springframework.ai.chat.client.ChatClient;
import org.springframework.ai.ollama.OllamaChatModel;
import org.springframework.ai.openai.OpenAiChatModel;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @description: com.ti.demo.configuration
 * @Author Triagen
 * @Date 2025/7/18 11:12
 */
@Configuration
public class ChatClientConfiguration {
    @Bean("ollamaChatClient")
    public ChatClient ollamaChatClient(OllamaChatModel ollamaChatModel){
        return ChatClient.builder(ollamaChatModel).defaultSystem("You are a helpful image recognition assistant.").build();
    }


    /**
     * a manual ChatClient example,to gain better understanding of api, model and chatClient
     * generally speaking, api includes the connection info, model includes the model choice, and chatClient is the assembly of both
     *
     * @param openAiChatModel
     * @return
     */
    @Bean("openaiChatClient")
    public ChatClient openaiChatClient(OpenAiChatModel openAiChatModel){
        return ChatClient.builder(openAiChatModel).defaultSystem("You are a good joker.").build();
    }


}
